<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<tr:document xmlns="http://www.w3.org/1999/xhtml"
             xmlns:ui="http://java.sun.com/jsf/facelets"
             xmlns:h="http://java.sun.com/jsf/html"
             xmlns:f="http://java.sun.com/jsf/core"
             xmlns:mias="http://www.monsters.inc/mias"
             xmlns:tr="http://myfaces.apache.org/trinidad">

<ui:composition template="templates/template.xhtml">
  <!--
       This page lists all kids. 
  -->
  <ui:define name="title">Overview of kids!</ui:define>
  <ui:define name="content"> 
      <tr:table var="kid" value="#{kidsTable.kids}" rows="20" id="kids" 
                rowBandingInterval="1" horizontalGridVisible="false" 
                allDetailsEnabled="true" rowSelection="multiple"
                binding="#{kidsTable.table}" 
                selectionListener="#{kidsTable.selectionChanged}"
                autoSubmit="true" partialSubmit="true" >
        <mias:column columnName="name" custom="true" >
          <mias:column columnName="firstName" bean="#{kid}" />
          <mias:column columnName="lastName" bean="#{kid}" sortable="true" />
        </mias:column>
        <mias:column columnName="age" bean="#{kid}" sortable="true" />
        <mias:column columnName="lastScared" bean="#{kid}" sortable="true" />
        <mias:column columnName="braveness" bean="#{kid}" sortable="true">
          <f:convertNumber minFractionDigits="1" maxFractionDigits="1" 
                           minIntegerDigits="1" maxIntegerDigits="2" />
        </mias:column>
        <mias:column columnName="edit" headerName="emptyTableHeader" custom="true">
          <tr:commandLink action="edit" immediate="true">
            <tr:image source="../images/pencil.png" inlineStyle="border-width: 0px;" />
            <tr:setActionListener to="#{requestScope.selectedKid}" from="#{kid}"/>
          </tr:commandLink>
        </mias:column>    
        <f:facet name="detailStamp">
          <h:panelGroup>
            <mias:field id="birthDate" bean="#{kid}" readOnly="true">
              <f:convertDateTime pattern="#{msg.datePattern}" />
            </mias:field>
            <mias:field id="country" bean="#{kid}" readOnly="true"/>
            <mias:field id="comment" bean="#{kid}" readOnly="true"/>
          </h:panelGroup>
        </f:facet>
        <f:facet name="actions">
          <tr:panelButtonBar>
            <tr:commandButton text="#{msg.new}" 
                              id="btnNew" action="#{kidsTable.newKid}" immediate="true"/>
            <tr:commandButton actionListener="#{kidsTable.deleteSelected}" text="#{msg.delete}" 
                              disabled="#{!kidsTable.deleteEnabled}" partialSubmit="true"
                              id="btnDelete" binding="#{kidsTable.deleteButton}" />
          </tr:panelButtonBar>        
        </f:facet>
      </tr:table>
  </ui:define>
</ui:composition>

</tr:document>